package com.changgou.listener;

import com.changgou.service.ESManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 监听删除索引库
 */
@Component
public class GoodsDelListener {

    @Autowired
    private ESManagerService esManagerService;

    @RabbitListener(queues = "search_del_queue")
    public void receiveMessage(String spuId){
        System.out.println("删除索引库监听类,接收到的spuId:  "+spuId);
        try{
            esManagerService.delDataBySpuId(spuId);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
